import React,{Component} from "react";
import { createStackNavigator } from "@react-navigation/stack";
import MyTabs from '../page/main/main';
import WorkPage from '../page/main/job_page'
import WebViewPage from '../page/knowledge/webViewPage'
import KnowledgeDetail from '../page/knowledge/knowledgeDetail'
import hotKnowledgeList from "../page/knowledge/hotKnowledgeList";
import hotInfoPage from "../page/knowledge/hotInfoPage";
import searchPage from "../page/knowledge/searchPage";
import jobDetail from "../page/job/jobDetail"
import PublishWork from "../page/job/PublishWork";
import ContributeWork from "../page/job/ContributeWork";
import FansList from "../page/message/fansList";
import CommentList from "../page/message/commentList";
import SystemMessageList from "../page/message/systemMessageList";
import TopicDetail from "../page/community/TopicDetail";
import PublishTopic from "../page/community/publishTopic";
import SelectTopic from "../page/community/selectTopic";
import DynamicDevelopmentDetail from "../page/community/dynamicDevelopmentDetail";
import CCommentList from '../page/community/commentList'
import PersonHomePage from "../page/community/personHomePage";
import MallList from "../page/mall/mallList";
import ProdDetail from "../page/mall/ProdDetail";
import SubmitOrder from "../page/mall/submitOrder";
import AddressList from "../page/mall/addressList";
import AddAddress from "../page/mall/addAddress";
import OrderList from "../page/mall/OrderList";
import OrderDetail from "../page/mall/OrderDetail";
import MyIntegral from "../page/me/MyIntegral";
import IntegralRecord from "../page/me/IntegralRecord";
import MyFansList from '../page/me/MyFansList'
import MyJobList from '../page/me/MyJobList'
import Set from '../page/me/Set'
import BlackList from "../page/me/BlackList";
import HelpAndFeedBack from "../page/me/HelpAndFeedBack";
import MyLearnRecord from "../page/me/MyLearnRecord";
import MyFavor from "../page/me/MyFavor";
import ModifyInfo from "../page/me/ModifyInfo";
import ModifyItemInfo from "../page/me/ModifyItemInfo";
import BackBarItem from '../widget/backBarItem'
import LoginPage from "../page/login/login_page";
import WebViewVC from '../page/main/webView'

const Stack = createStackNavigator();
const routerStack=()=>{
  return (
    <Stack.Navigator initialRouteName={'Main'}>
      {/*主页*/}
      <Stack.Screen name="Main" options={{
        headerShown:false
      }} component={MyTabs}/>
      <Stack.Screen name="WebViewPage" options={{
        headerShown: false // work
      }} component={WebViewPage}/>
      <Stack.Screen name="knowledgeDetail"options={{
        headerShown: false // work
      }} component={KnowledgeDetail}/>
      <Stack.Screen name='hotKnowledgeList' component={hotKnowledgeList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name='hotInfoPage' component={hotInfoPage} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name='searchPage' component={searchPage} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'WorkPage'} component={WorkPage} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'jobDetail'} component={jobDetail} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name='PublishWork' component={PublishWork} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name="ContributeWork" options={{
        headerShown: false // work
      }} component={ContributeWork}/>
      <Stack.Screen name={'FansList'} component={FansList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'CommentList'} component={CommentList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'SystemMessageList'} component={SystemMessageList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'TopicDetail'} component={TopicDetail} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'PublishTopic'} component={PublishTopic} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'SelectTopic'} component={SelectTopic} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name='DynamicDevelopmentDetail' component={DynamicDevelopmentDetail} options={({navigation})=>({title:'动态详情',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name='CCommentList' component={CCommentList} options={({navigation})=>({title:'评论详情',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'PersonHomePage'} component={PersonHomePage} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'MallList'} component={MallList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'ProdDetail'} component={ProdDetail} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'SubmitOrder'} component={SubmitOrder} options={({navigation})=>({title:'立即兑换',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'AddressList'} component={AddressList} options={({navigation})=>({title:'收货地址',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'AddAddress'} component={AddAddress} options={({navigation})=>({title:'收货地址',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'OrderList'} component={OrderList} options={({navigation})=>({title:'兑换订单',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'OrderDetail'} component={OrderDetail} options={({navigation})=>({title:'订单详情',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
      <Stack.Screen name={'MyIntegral'} component={MyIntegral} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'IntegralRecord'} component={IntegralRecord} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'MyFansList'} component={MyFansList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'Set'} component={Set} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'BlackList'} component={BlackList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'HelpAndFeedBack'} component={HelpAndFeedBack} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'MyLearnRecord'} component={MyLearnRecord} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'MyFavor'} component={MyFavor} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'MyJobList'} component={MyJobList} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'ModifyInfo'} component={ModifyInfo} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'ModifyItemInfo'} component={ModifyItemInfo} options={{headerShown:false}}></Stack.Screen>
      <Stack.Screen name={'WebViewVC'} component={WebViewVC} options={({navigation})=>({title:'',headerLeft:()=>{
          return (<BackBarItem navigation={navigation}></BackBarItem>)
        }})}></Stack.Screen>
    </Stack.Navigator>
  )
}

const loginStack=()=>{
  return (
    <Stack.Navigator initialRouteName={'Login'} headerMode={'none'} headerShown={false}>
      {/* 登录 */}
      <Stack.Screen name="Login" component={LoginPage}/>
    </Stack.Navigator>
  )
}

export {routerStack,loginStack}
